﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="servicos.aspx.cs" Inherits="servicos"  EnableEventValidation="false"%>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<%@ Register src="../../controles/endereco_bairro.ascx" tagname="endereco_bairro" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Panel ID="Panel1" runat="server">
        <table style="width: 100%">
            <tr>
                <td>
                    Serviço</td>
                <td>
                    <asp:TextBox ID="txtDescricao" runat="server" ValidationGroup="insercao"></asp:TextBox>
                </td>
                <td width="100%">
                    <asp:Button ID="btnPesquisar" runat="server" onclick="btnPesquisar_Click" 
                        Text="Buscar" Width="70px" CausesValidation="False" />
                    &nbsp;<asp:Button ID="btnIncluir" runat="server" OnClick="btnIncluir_Click" 
                        Text="Incluir" ValidationGroup="insercaoEnderecoFuncionario" Width="70px" />
                </td>
            </tr>
        </table>
        <asp:Panel ID="pnlInserir" runat="server" SkinID="Insercao" Visible="False" 
            Width="100%">
            <table style="padding: 3px; width: 100%">
                <tr>
                    <td class="titulo3" colspan="2">
                        Informações do serviço</td>
                </tr>
                <tr>
                    <td style="width: 193px; text-align: right;">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtNome" ErrorMessage="*" Font-Names="Vrinda" 
                            Font-Size="16pt" ForeColor="#FF6699" SetFocusOnError="True" 
                            ValidationGroup="insercao">*</asp:RequiredFieldValidator>
                        Nome do serviço</td>
                    <td>
                        <asp:TextBox ID="txtNome" runat="server" MaxLength="100" Width="300px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="width: 193px; text-align: right;">
                        Valor:</td>
                    <td>
                        <asp:TextBox ID="txtValor" runat="server" Width="70px"></asp:TextBox>
                        <cc1:MaskedEditExtender ID="txtValor_MaskedEditExtender" runat="server" 
                            CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                            CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                            CultureThousandsPlaceholder="" CultureTimePlaceholder="" DisplayMoney="Left" 
                            Enabled="True" InputDirection="RightToLeft" Mask="999,99" MaskType="Number" 
                            TargetControlID="txtValor">
                        </cc1:MaskedEditExtender>
                    </td>
                </tr>
                <tr>
                    <td style="width: 193px; text-align: right;">
                        &nbsp;</td>
                    <td>
                        <asp:Button ID="btnIncluir0" runat="server" 
                            Text="Incluir" ValidationGroup="insercao" Width="70px" 
                            onclick="btnIncluir0_Click1" />
                        <cc1:ModalPopupExtender ID="btnIncluir_ModalPopupExtender" runat="server" 
                            BackgroundCssClass="modalBackground" CancelControlID="btnNao" 
                            DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirm" 
                            TargetControlID="btnIncluir0">
                        </cc1:ModalPopupExtender>
                        &nbsp;<asp:Button ID="btnCancela" runat="server" onclick="btnCancela_Click" 
                            Text="Cancelar" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <table class="style5">
            <tr>
                <td valign="top">
                    <asp:GridView ID="grdServicos" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" DataKeyNames="idServico" 
                        DataSourceID="linqServicos" EmptyDataText="Nenhum serviço encontrado." 
                        EnableTheming="True" ondatabound="grdEquipamentos_DataBound" 
                        onrowcreated="grdEquipamentos_RowCreated" 
                        onselectedindexchanged="grdSituacoes_SelectedIndexChanged" SkinID="q" 
                        Width="380px">
                        <Columns>
                            <asp:TemplateField HeaderText="Lista de Serviços" InsertVisible="False" 
                                SortExpression="idSituacao">
                                <EditItemTemplate>
                                    <table style="width: 100%">
                                        <tr>
                                            <td ID="20">
                                                <asp:TextBox ID="TextBox1" runat="server" MaxLength="100" 
                                                    Text='<%# Bind("Nome") %>' Width="300px"></asp:TextBox>
                                                <br />
                                                Valor<br />
                                                <asp:TextBox ID="txtValor" runat="server" Text='<%# Bind("preco", "{0:C}") %>' 
                                                    Width="70px"></asp:TextBox>
                                                <cc1:MaskedEditExtender ID="txtValor_MaskedEditExtender" runat="server" 
                                                    CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                                    CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                    CultureThousandsPlaceholder="" CultureTimePlaceholder="" DisplayMoney="Left" 
                                                    Enabled="True" InputDirection="RightToLeft" Mask="999,99" MaskType="Number" 
                                                    TargetControlID="txtValor">
                                                </cc1:MaskedEditExtender>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td ID="21" align="center">
                                                <asp:Button ID="btnSalvar" runat="server" CommandName="Update" TabIndex="1" 
                                                    Text="Salvar" Width="100px" />
                                                &nbsp;<asp:Button ID="btnSalvar0" runat="server" CommandName="Cancel" TabIndex="2" 
                                                    Text="Cancelar" Width="100px" />
                                            </td>
                                        </tr>
                                    </table>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <table style="width: 100%">
                                        <tr>
                                            <td ID="2">
                                                <asp:LinkButton ID="lkbSelect" runat="server" CommandName="Select" 
                                                    CssClass="titulo3" onclick="LinkButton1_Click" Text='<%# Eval("nome") %>'></asp:LinkButton>
                                            </td>
                                            <td ID="2" align="right" width="80">
                                                <asp:Label ID="lbValor" runat="server" Font-Bold="True" 
                                                    Text='<%# Bind("preco", "{0:C}") %>'></asp:Label>
                                            </td>
                                            <td valign="top" width="20">
                                                <asp:Button ID="Button2" runat="server" CommandName="Edit" SkinID="EditarOnTop" 
                                                    ValidationGroup="edicao" />
                                            </td>
                                            <td valign="top" width="20">
                                                <asp:Button ID="btnDelete" runat="server" CommandName="Select" 
                                                    onclick="btnDelete_Click" SkinID="ExcluirOnTop" />
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
                <td valign="top" width="100%">
                    <asp:Panel ID="pnlInserir0" runat="server" SkinID="Insercao" Width="380px" 
                        Enabled="False">
                        <table style="padding: 3px; width: 100%">
                            <tr>
                                <td class="titulo3" colspan="2">
                                    Equipamentos atendidos pelo serviço</td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    Equipamentos:</td>
                                <td>
                                    <asp:DropDownList ID="dropEquipamentos" runat="server" 
                                        ValidationGroup="insercaoequipamento" Width="280px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    &nbsp;</td>
                                <td>
                                    <asp:Button ID="btnIncluir1" runat="server" onclick="btnIncluir1_Click" 
                                        Text="Incluir" ValidationGroup="insercaoequipamento" Width="70px" />
                                    <cc1:ModalPopupExtender ID="btnIncluir_ModalPopupExtender0" runat="server" 
                                        BackgroundCssClass="modalBackground" CancelControlID="btnNao" 
                                        DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirm" 
                                        TargetControlID="btnIncluir0">
                                    </cc1:ModalPopupExtender>
                                    &nbsp;<asp:Button ID="btnCancela0" runat="server" onclick="btnCancela_Click" 
                                        Text="Cancelar" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <br />
                    <asp:GridView ID="grdServicosEquipamentos" runat="server" 
                        AutoGenerateColumns="False" DataKeyNames="idServico,idEquipamento" 
                        EmptyDataText="Nenhum equipamento encontrado para o serviço." 
                        EnableTheming="True" onrowcreated="grdEquipamentos_RowCreated" 
                        onselectedindexchanged="grdServicosEquipamentos_SelectedIndexChanged1" 
                        SkinID="q" Width="380px">
                        <Columns>
                            <asp:TemplateField HeaderText="Lista de equipamentos do serviço" 
                                InsertVisible="False" SortExpression="idSituacao">
                                <ItemTemplate>
                                    <table style="width: 100%">
                                        <tr>
                                            <td ID="24">
                                                <asp:Label ID="Label4" runat="server" CssClass="titulo3" Font-Bold="True" 
                                                    Text='<%# Bind("EQUIPAMENTO.Nome") %>'></asp:Label>
                                            </td>
                                            <td align="right" valign="top" width="50">
                                                <asp:Button ID="Button4" runat="server" CommandName="Select" 
                                                    SkinID="ExcluirOnTop" />
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <br />
        <asp:LinqDataSource ID="linqServicos" runat="server" 
            ContextTypeName="dbSisInfoDataContext" EnableDelete="True" EnableUpdate="True" 
            OrderBy="nome" TableName="Servicos">
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="linqServicosEquipamentos" runat="server" 
            ContextTypeName="dbSisInfoDataContext" TableName="SERVICOS_EQUIPAMENTOs" 
            EnableDelete="True">
        </asp:LinqDataSource>
        <asp:Panel ID="pnlConfirm" runat="server" Height="100px" 
            HorizontalAlign="Center" SkinID="Confirmacao" Width="300px">
            <br />
            <asp:Label ID="Label2" runat="server" Text="Deseja confirmar?"></asp:Label>
            <br />
            <br />
            <asp:Button ID="btnSim" runat="server" onclick="btnIncluir0_Click" Text="Sim" 
                ValidationGroup="insercao" />
            <asp:Button ID="btnNao" runat="server" Text="Nao" />
            <br />
            <asp:UpdateProgress ID="UpdateProgress2" runat="server">
                <ProgressTemplate>
                    CARREGANDO...
                </ProgressTemplate>
            </asp:UpdateProgress>
        </asp:Panel>
        <asp:Panel ID="pnlConfirmDelete" runat="server" Height="100px" 
            HorizontalAlign="Center" SkinID="Confirmacao" Width="300px">
            <br />
            <asp:Label ID="Label3" runat="server" Text="Deseja confirmar?"></asp:Label>
            <br />
            <br />
            <asp:Button ID="btnSim0" runat="server" CausesValidation="False" Text="Sim" 
                onclick="btnSim0_Click" />
            <asp:Button ID="btnNao0" runat="server" CausesValidation="False" Text="Nao" />
            <br />
            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    CARREGANDO...
                </ProgressTemplate>
            </asp:UpdateProgress>
        </asp:Panel>
        <asp:Panel ID="pnlConfirmDeleteSE" runat="server" Height="100px" 
            HorizontalAlign="Center" SkinID="Confirmacao" Width="300px">
            <br />
            <asp:Label ID="Label5" runat="server" Text="Deseja confirmar?"></asp:Label>
            <br />
            <br />
            <asp:Button ID="btnSimSE" runat="server" CausesValidation="False" 
                onclick="btnSimSE_Click" Text="Sim" />
            <asp:Button ID="btnNao1" runat="server" CausesValidation="False" Text="Nao" />
            <br />
            <asp:UpdateProgress ID="UpdateProgress3" runat="server">
                <ProgressTemplate>
                    CARREGANDO...
                </ProgressTemplate>
            </asp:UpdateProgress>
        </asp:Panel>
        <asp:Label ID="lbDelete" runat="server" Text="."></asp:Label>
        <br />
        <cc1:ModalPopupExtender ID="Button1_ModalPopupExtender" runat="server" 
            BackgroundCssClass="modalBackground" CancelControlID="btnNao0" 
            DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirmDelete" 
            TargetControlID="lbDelete">
        </cc1:ModalPopupExtender>
          <cc1:ModalPopupExtender ID="ModalPopupExtenderDeleteES" runat="server" 
            BackgroundCssClass="modalBackground" CancelControlID="btnNao1" 
            DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirmDeleteSE" 
            TargetControlID="lbDelete">
        </cc1:ModalPopupExtender>
    </asp:Panel>
</asp:Content>

